package com.ruochen.recipe.customer;

import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.blankj.utilcode.util.KeyboardUtils;
import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.SizeUtils;
import com.lxj.xpopup.core.CenterPopupView;
import com.ruochen.common.listener.NoDoubleClickListener;
import com.ruochen.recipe.R;

public class OrderSurePopup extends CenterPopupView {

    private LinearLayout llPopupContainer;
    private TextView rtvSure;
    private TextView rtvCancel;
    private EditText etRemarks;

    public OrderSurePopup(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        llPopupContainer = findViewById(R.id.llPopupContainer);
        rtvSure = findViewById(R.id.rtvSure);
        rtvCancel = findViewById(R.id.rtvCancel);
        etRemarks = findViewById(R.id.etRemarks);
        rtvSure.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View view) {
                dismiss();
            }
        });
        rtvCancel.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View view) {
                dismiss();
            }
        });
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        KeyboardUtils.hideSoftInput(this);
        return super.onTouchEvent(event);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.popup_sure_order;
    }

    @Override
    protected int getMaxHeight() {
        return (int) (ScreenUtils.getScreenHeight() * 0.75);
    }

    @Override
    protected int getMaxWidth() {
        return SizeUtils.dp2px(600);
    }
}
